<?php
function utf8($n) {
        return (utf8_encode($n));
        }

$data = json_decode(file_get_contents("php://input"),true);
//$recu='test serveur ok Reception ';
//foreach ($data as $key => $value){
//$recu=$recu.' cle-> '.$key.' valeur :'.$value;
  //          }
//$recu=$recu.' transfert ';
$recu = "";
$id=$data['ID']; 
$pass=$data['pass']; 
$host="mysql.hostinger.fr	";                  
$username="u127240370_edf";       
$password="rachel";               
$db_name="u127240370_edf";                
$con=mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name") or die ("cannot select DB"); 
$sql = "SELECT * FROM client ,controleur where idcontroleur=id and id='".$id."' and mp=md5('".$pass."')";   
$result = mysql_query($sql);
$json = array(); 
if(mysql_num_rows($result)){
while($row=mysql_fetch_assoc($result)){ 
$json[]=array_map('utf8',$row);
 
}
mysql_close($con);
$recu = json_encode($json);
echo $recu; 
}
else
{
mysql_close($con);
$recu = "";
echo $recu;
}
?>
